﻿using FriendStar.Code;
using FriendStar.Domain.Entity.VBaseData;
using FriendStar.Domain.IRepository.VBaseData;
using FriendStar.Repository.VBaseData;
using System.Collections.Generic;
using System.Linq;
using SqlSugarRepository;

namespace FriendStar.Application.VBaseData
{
    public class V_CPK_47_MX_StoCPKListAcco_Arc_TypeApp
    {
        private IV_CPK_47_MX_StoCPKListAcco_Arc_TypeRepository service = new V_CPK_47_MX_StoCPKListAcco_Arc_TypeRepository();

        public List<V_CPK_47_MX_StoCPKListAcco_Arc_TypeEntity> GetList(Pagination pagination, string faccountDate, string fproductionNo, string fproductionName, string fproCompanyNO, string fproductionTypeName)
        {
            var expression = ExtLinq.True<V_CPK_47_MX_StoCPKListAcco_Arc_TypeEntity>();
            if (!string.IsNullOrEmpty(faccountDate))
            {
                expression = expression.And(t => t.FAccountDate.Contains(faccountDate));
            }
            if (!string.IsNullOrEmpty(fproductionNo))
            {
                expression = expression.And(t => t.FProductionNO.Contains(fproductionNo));
            }
            if (!string.IsNullOrEmpty(fproductionName))
            {
                expression = expression.And(t => t.FProductionName.Contains(fproductionName));
            }
            if (!string.IsNullOrEmpty(fproCompanyNO))
            {
                expression = expression.And(t => t.FProCompanyNO.Contains(fproCompanyNO));
            }
            if (!string.IsNullOrEmpty(fproductionTypeName))
            {
                expression = expression.And(t => t.FProductionTypeName.Contains(fproductionTypeName));
            }
            return service.FindList(expression, pagination).OrderBy(t => t.UseUnit).ToList();
        }
        public V_CPK_47_MX_StoCPKListAcco_Arc_TypeEntity GetForm(string keyValue)
        {
            return service.FindEntity(keyValue);
        }

    }
}
